//
//  BTBaseTabBarViewController.m
//  PFBrainTwister
//
//  Created by perfayMini on 2018/9/19.
//  Copyright © 2018年 perfayMini. All rights reserved.
//

#import "BTBaseTabBarViewController.h"
//#import "BTCatagoriesViewController.h"
//#import "BTJokerViewController.h"
//#import "BTRiddleViewController.h"
//#import "BTIdiomListViewController.h"

#import "BTWebViewController.h"
#import "PFSetViewController.h"
#import "PFScanViewController.h"
#import "PFHistoryViewController.h"

@interface BTBaseTabBarViewController ()

@end

@implementation BTBaseTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tabBar.tintColor = [UIColor qmui_colorWithHexString:@"a58eee"];
}

- (instancetype)init{
    if(self = [super init]){
        [self initSubControllers];
    }
    return self;
}

- (void)initSubControllers{
    PFScanViewController * catagoriesViewController = [[PFScanViewController alloc] init];
    BaseNavigationController *catagoriesNav= [[BaseNavigationController alloc] initWithRootViewController:catagoriesViewController];
    catagoriesNav.tabBarItem.title = @"扫描";
    catagoriesNav.tabBarItem.image = [UIImage imageNamed:@"扫描normal"];
    catagoriesNav.tabBarItem.selectedImage = [UIImage imageNamed:@"扫描"];

    PFHistoryViewController * hisViewController = [[PFHistoryViewController alloc] init];
    BaseNavigationController * hisNav= [[BaseNavigationController alloc] initWithRootViewController:hisViewController];
    hisNav.tabBarItem.title = @"历史";
    hisNav.tabBarItem.image = [UIImage imageNamed:@"历史"];
    hisNav.tabBarItem.selectedImage = [UIImage imageNamed:@"历史selected"];
    
    PFSetViewController * setVc= [[PFSetViewController alloc] init];
    BaseNavigationController *setNaVc= [[BaseNavigationController alloc] initWithRootViewController:setVc];
    setNaVc.tabBarItem.title = @"设置";
    setNaVc.tabBarItem.image = [UIImage imageNamed:@"设置normal"];
    setNaVc.tabBarItem.selectedImage = [UIImage imageNamed:@"设置"];
    
    self.viewControllers = @[catagoriesNav,hisNav,setNaVc];
    
    
}


- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
//    NSString *first =  [[NSUserDefaults standardUserDefaults] valueForKey:@"first"];
//    if (![first isEqualToString:@"1"]) {
//        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//            BTWebViewController *tiaok = [[BTWebViewController alloc]init];
//            [self presentViewController:tiaok animated:YES completion:NULL];
//        });
//    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
